//
//  MovieTableViewCell.m
//  YHYRealx
//
//  Created by yanghuiyan on 16/4/20.
//  Copyright © 2016年 yanghuiyan. All rights reserved.
//

#import "MovieTableViewCell.h"

@implementation MovieTableViewCell

- (void)dealloc {
    
    [_pic release];
    
    [super dealloc];
    
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.pic = [UIImageView new];
        
        [self.contentView addSubview:_pic];
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [_pic mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(5);
        
        make.left.equalTo(self.contentView).offset(5);
        
        make.right.equalTo(self.contentView).offset(-5);
        
        make.bottom.equalTo(self.contentView).offset(-5);
        
    }];
    
}

- (void)setMovieModel:(MovieModel *)movieModel {
    
    if (_movieModel != movieModel) {
        [_movieModel release];
        _movieModel = [movieModel retain];
    }
    
    [_pic sd_setImageWithURL:[NSURL URLWithString:_movieModel.cover]];
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
